# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=SDL2_net
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.0.1
pkgrel=1
pkgdesc="A small sample cross-platform networking library (Version 2) (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://libsdl.org/projects/SDL_net"
license=("MIT")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-SDL2")
options=('staticlibs' 'strip')
source=("${url}/release/${_realname}-${pkgver}.tar.gz")
sha256sums=('15ce8a7e5a23dafe8177c8df6e6c79b6749a03fff1e8196742d3571657609d21')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
